//
//  BaseCollectionViewCell.m
//  OverseasOnlineShopping
//
//  Created by 唐先才 on 16/3/7.
//  Copyright © 2016年 唐先才. All rights reserved.
//

#import "BaseCollectionViewCell.h"
#import "UIImageView+WebCache.h"

@interface BaseCollectionViewCell ()

@property (weak, nonatomic) IBOutlet UIImageView *tagView;
@property (weak, nonatomic) IBOutlet UIImageView *iconView;
@property (weak, nonatomic) IBOutlet UILabel *titleLab;
@property (weak, nonatomic) IBOutlet UILabel *priceLab;
@property (weak, nonatomic) IBOutlet UILabel *mallLab;

@end

@implementation BaseCollectionViewCell

- (void)setModel:(TxcModel *)model {
    _model = model;
    if ([model.InfoNation intValue] == 2) {
        _tagView.image = [UIImage imageNamed:@"tag_nation"];
    }
    [_iconView sd_setImageWithURL:[NSURL URLWithString:model.MainImage]];
    _titleLab.text = model.InfoTitle;
    _priceLab.text = model.CommodityPrice;
    _mallLab.text = [NSString stringWithFormat:@"%@供货", model.MallName];
}

+ (UICollectionViewCell *)configCellWith: (UICollectionView *)collectionView indexPath: (NSIndexPath *)indexPath dataArray: (NSMutableArray *)dataArray {
    BaseCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"baseCollectionViewCell" forIndexPath:indexPath];
    if (dataArray.count > 0) {
        cell.model = dataArray[indexPath.row];
    }
    cell.backgroundColor = [UIColor whiteColor];
    return cell;
}

- (void)awakeFromNib {
    // Initialization code
}

@end
